#define _CRT_SECURE_NO_WARNINGS 1



#include<iostream>
using namespace std;
int main()
{
    int n;
    cin >> n;
    while (n--)
    {
        int ans = 0;
        cin >> ans;
        if (ans == 1)
            cout << 2 << " " << 3 << endl;
        else if (ans == 1e9)
            cout << (ans >> 1) << " " << (ans ^ (ans >> 1)) << endl;
        else
            cout << 1 << " " << (ans ^ 1) << endl;
    }
    return 0;
}